package com.example.edwincompose.feature.main

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.example.edwincompose.feature.splash.SPLASH_ROUTE

const val MAIN_ROUTE="main"

fun NavController.navigateToMain():Unit{
    navigate(MAIN_ROUTE){
        //表示只会打开一个页面实例。
        launchSingleTop=true

        //跳转以后，关闭之前的所有页面
        popUpTo(SPLASH_ROUTE){
            inclusive=true
        }

    }
}

//配置4
fun NavGraphBuilder.mainScreent(){
    //这句代码是什么意思？
    composable(MAIN_ROUTE) {
        MainRoute()
    }
}